function residual = func_ireland(eeta,eeta_f_bar,llambda,llambda_f_bar,mkt_pwr,b)

if mkt_pwr=='me'
    residual = (eeta-1)*log(b)+2*(eeta-1)-eeta_f_bar*(eeta-1)-llambda_f_bar*b^llambda;
else if mkt_pwr=='ce'
    residual = (eeta-1)*log(b)+(eeta-1)-eeta_f_bar*(eeta-1)-llambda_f_bar*b^llambda;
end

end